import '/@/design/index.less'
import 'virtual:windi-base.css'
import 'virtual:windi-components.css'
import 'virtual:windi-utilities.css'
import 'virtual:svg-icons-register'
import App from './App.vue'
import { createApp } from 'vue'
import { initAppConfigStore } from '/@/logics/initAppConfig'
import { setupErrorHandle } from '/@/logics/error-handle'
import { router, setupRouter } from '/@/router'
import { setupRouterGuard } from '/@/router/guard'
import { setupStore } from '/@/store'
import { setupGlobDirectives } from '/@/directives'
import { setupI18n } from '/@/locales/setupI18n'
import { registerGlobComp } from '/@/components/registerGlobComp'

import VXETable from 'vxe-table'
import VXETablePluginExportXLSX from 'vxe-table-plugin-export-xlsx'
import 'vxe-table/lib/style.css'

import 'animate.css/animate.min.css'

VXETable.use(VXETablePluginExportXLSX)

if (import.meta.env.DEV) {
  import('ant-design-vue/dist/antd.less')
}

import '/@/assets/less/common.less'

function useTable (app) {
  app.use(VXETable)
}

async function bootstrap() {
  const app = createApp(App)

  useTable(app)

  setupStore(app)

  initAppConfigStore()

  registerGlobComp(app)

  await setupI18n(app)

  setupRouter(app)

  setupRouterGuard(router)

  setupGlobDirectives(app)

  setupErrorHandle(app)

  app.mount('#app')
}

bootstrap();
